package com.itheima.demo;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

public class Test_002 {
    public static void main(String[] args) {
        List<String> list = new ArrayList<String>();

        list.add("张三丰");
        list.add("张翠山");
        list.add("张无忌");
        /*for (int i = list.size()-1; i >=0 ; i--) {
            System.out.println(list.get(i));
        }*/
        Collections.reverse(list);
        //System.out.println(list);
        Iterator<String> it = list.iterator();
        while (it.hasNext()) {
            String next = it.next();
            System.out.println(next);
        }
        for (String s : list) {
            System.out.println(s);
        }


    }

}
